var name1 = 0, people = 0, wm = 0, num = 0;
//验证用户名
function getUsername() {
    var reg = /^[0-9a-zA-Z]+$/;
    var usern = document.getElementsByClassName('username')[0];
    if (reg.test(usern.value)) {
        name1 = 1
        usern.nextElementSibling.style.display='none';
        usern.style.border='skyblue solid 1px';
    } else {
        usern.nextElementSibling.style.display='block';
        usern.nextElementSibling.innerHTML = '请填写公司/团队名称';
        usern.nextElementSibling.style.color='#f00';
        usern.style.border='#f00 solid 1px'
    }
}
function username1(){
    var reg = /^[0-9a-zA-Z]+$/;
    var usern = document.getElementsByClassName('username')[0];
    if (reg.test(usern.value)) {
        usern.nextElementSibling.style.display='none'
        usern.style.border="#dcdcdc solid 1px";

    } else {
        usern.nextElementSibling.style.display='block';
        usern.nextElementSibling.innerHTML = '请填写公司/团队名称';
        usern.nextElementSibling.style.color='#f00';
        usern.style.border="#f00 solid 1px"
        
    }
}
//参观人数
function getpeople(){
    var reg=/^[0-9]+$/;
    var peo=document.getElementsByClassName('people')[0];
    if(reg.test(peo.value)){
        people=1
        peo.nextElementSibling.style.display="none";
        peo.style.border='#skyblue solid 1px'
    }
    else{
        peo.nextElementSibling.style.display="block";
        peo.nextElementSibling.innerHTML="请填写参观人数";
        peo.nextElementSibling.style.color="#f00";
        peo.style.border="#f00 solid 1px"
    }
}
function userpeople(){
    var reg=/^[0-9]+$/;
    var peo=document.getElementsByClassName('people')[0];
    if(reg.test(peo.value)){
        peo.nextElementSibling.style.display="none";
        peo.style.border="#dcdcdc solid 1px"
    }
    else{
        peo.nextElementSibling.style.display="block";
        peo.nextElementSibling.innerHTML="请填写参观人数";
        peo.nextElementSibling.style.color="#f00";
        peo.style.border="#f00 solid 1px"
    }
  }  
    //联系人
function getUserpeople(){
    var reg=/^[0-9a-zA-Z]+$/
    var wm=document.getElementsByClassName('userpeople')[0];
    if(reg.test(wm.value)){
        wm=1
        wm.nextElementSibling.style.display="none";
        wm.style.border="#skyblue solid 1px"
    }
    else{
        wm.nextElementSibling.style.display="block";
        wm.nextElementSibling.innerHTML="请输入姓名";     
        wm.nextElementSibling.style.color="#f00"
        wm.style.border="#f00 solid 1px";
    }
}
function peoples(){
    var reg=/^[0-9a-zA-Z]+$/
    var wm=document.getElementsByClassName('userpeople')[0];
    if(reg.test(wm.value)){
        wm.nextElementSibling.style.display="none";
        wm.style.border="#dcdcdc solid 1px"
    }
    else{
        wm.nextElementSibling.style.display="block";
        wm.nextElementSibling.innerHTML="请输入姓名";       
        wm.nextElementSibling.style.color="#f00"
        wm.style.border="#f00 solid 1px";
    }
}
//验证手机号
function tell1(){
    var reg=/^(1[3-9])\d{9}$/
    var num=document.getElementsByClassName('tellphone')[0];
    if(reg.test(num.value)){
        num=1
        num.nextElementSibling.style.display="none";
        num.style.border="#skyblue solid 1px"
    }
    else{
        num.nextElementSibling.style.display="block";
        num.nextElementSibling.innerHTML="请输入手机号";
        num.nextElementSibling.style.color="#f00";
        num.style.border="#f00 solid 1px"
    }
}
function notell(){
    var reg=/^(1[3-9])\d{9}$/
    var num=document.getElementsByClassName('tellphone')[0];
    if(reg.test(num.value)){
        num.nextElementSibling.style.display="none";
        num.style.border="#dcdcdc solid 1px"
    }
    else{
        num.nextElementSibling.style.display="block";
        num.nextElementSibling.innerHTML="手机格式不正确";
        num.nextElementSibling.style.color="#f00";
        num.style.border="#f00 solid 1px"
        if(!num.value){
            num.nextElementSibling.innerHTML="请输入手机号";
        }
    }
}

//提交
function subMit(){
    if(name1 && people && wm && num ){
        return 1;
    }
    else{
        return 0;
    }
}
